package com.wm.walmart.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wm.walmart.entity.Role;
import com.wm.walmart.service.IRoleService;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author xieyize
 * @since 2019-12-09
 */
@RestController
@RequestMapping("/role/")
public class RoleController {
	@Resource
	private IRoleService roleService;

	/**
	 * 添加角色信息 http://localhost:8080/walmart/role/insertRole?rName=aa
	 */
	@RequestMapping("insertRole")
	public Object insertRole(Role role) {
		return roleService.save(role);
	}

	/**
	 * 根据id修改角色信息 http://localhost:8080/walmart/role/updateRole?rId=7&rName=ab
	 */
	@RequestMapping("updateRole")
	public Object updateRole(Role role) {
		return roleService.updateById(role);
	}

	/**
	 * 根据id修改角色信息 http://localhost:8080/walmart/role/deleteRoleById?rId=7
	 */
	@RequestMapping("deleteRoleById")
	public Object deleteRoleById(Integer rId) {
		return roleService.removeById(rId);
	}
}
